<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./js/vue-2.4.0.js"></script>
  </head>
  <body>
    <div id="app">
      <input type="text" v-model="num1" />
      <select v-model="fuHao">
        <option value="0">+</option>
        <option value="1">-</option>
        <option value="2">*</option>
        <option value="3">/</option>
      </select>
      <input type="text" v-model="num2" />
      <button @click="operator">=</button>
      <input type="text" v-model="end" />
    </div>
  </body>
  <script>
    let vm = new Vue({
      el: "#app",
      data: {
        fuHao: 1,
        num1: "",
        num2: "",
        end: 0,
      },
      methods: {
        operator: function () {
          switch (this.fuHao) {
            case "0":
              this.end = Number(this.num1) + Number(this.num2);
              break;
            case "1":
              this.end = Number(this.num1) - Number(this.num2);
              break;
            case "2":
              this.end = Number(this.num1) * Number(this.num2);
              break;
            case "3":
              this.end = Number(this.num1) / Number(this.num2);
              break;
            default:
              break;
          }
        },
      },
    });
  </script>
</html>
